#include<stdio.h>
int main()
{
	int n,i,h;
	int m;
	scanf("%d",&n);
	for(i=0; i<n; i++)
	{
		scanf("%d",&m);
		if(m%2!=0)
		{
			printf("%d has no even factors",m);
		}
		for(h=2; h<=m; h++)
		{
			if((m%h==0)&&(h%2==0))
				printf("%d ",h);

		}
		printf("\n");
	}
	return 0;
}
